﻿using System.Configuration;
using UFIDA.U9.WSS.ProxyService.Behavior.WebHttp.Base;

namespace UFIDA.U9.WSS.ProxyService.Behavior.WebHttp
{
    public class GeneralServiceBehaviorExtension : NewtonsoftJsonBehaviorExtension<GeneralServiceBehavior>
    {
        /// <summary>
        ///     是否使用DataContract解析
        /// </summary>
        [ConfigurationProperty("useDataContract", DefaultValue = false, Options = ConfigurationPropertyOptions.None)]
        public bool UseDataContract
        {
            get
            {
                if (this["useDataContract"] == null || this["useDataContract"].ToString() == string.Empty) return false;
                return bool.Parse(this["useDataContract"].ToString());
            }
        }

        protected override object CreateBehavior()
        {
            return new GeneralServiceBehavior(UseDataContract);
        }
    }
}